package com.example.springstudy.myEventBus;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationEvent;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
 * @Auther ZhaoJunZhou
 * @Date 2020/7/22
 *
 * 这里是一个事件 在Springboot中要想使用事件的监听机制就需要
 * {@link ApplicationEvent} 这个方法
 *
 */

public class StringPublisherEvent extends ApplicationEvent {
    private String string;

    /**
     * Create a new {@code ApplicationEvent}.
     *
     * @param source the object on which the event initially occurred or with
     *               which the event is associated (never {@code null})
     */
    public StringPublisherEvent(Object source, String re) {
        super(source);
        this.string = re;
    }

    public String getString() {
        return string;
    }

    public void setString(String string) {
        this.string = string;
    }
}
